//Component Object
Component({
  options: {
    multipleSlots: true,
  },
  properties: {
    momentList: {
      type: Array,
      value: [],
    },
    bannerList: {
      type: Array,
      default: () => [],
    },
  },
  data: {
    // lang: wx.getStorageSync('lang'),
  },
  methods: {
    // 点击文章进入详情
    toMomentDetailHandle(e) {
      this.triggerEvent('toMomentDetailHandle', {
        momentId: e.currentTarget.dataset.momentid,
        title: e.currentTarget.dataset.title,
        type: e.currentTarget.dataset.type,
      })
    },
    // 收藏
    toCollectHandle(e) {
      let item = e.currentTarget.dataset
      this.triggerEvent('toCollectHandle', {
        momentId: item.momentid,
        collect: item.collect,
        collectId: item.collectid,
      })
    },
    // 广告点击
    adClickHandle(e) {
      this.triggerEvent('adClickHandle', {
        type: e.currentTarget.dataset.type,
        posterId: e.currentTarget.dataset.posterid,
        posterName: e.currentTarget.dataset.postername,
      })
    },
    //转发
    toForwardHandle(e) {
      this.triggerEvent('toForwardHandle', e.currentTarget.dataset.link)
    },
    scrollEnd(e) {
      console.log(e)
    },
  },
  attached() {
    this.setData({
      lang: wx.getStorageSync('lang'),
    })
  },
})
